package com.sgb.kjwl.view.ui.activity.self.userInfo;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import androidx.databinding.DataBindingUtil;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityFeedbackBinding;
import com.sgb.kjwl.viewmodel.self.userInfo.FeedbackModel;
import com.swgk.core.util.MToast;

import javax.inject.Inject;

public class FeedbackActivity extends AppActivity {

    private ActivityFeedbackBinding binding;

    @Inject
    FeedbackModel viewModel;

    public static void start(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, FeedbackActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected boolean statusBarDark() {
        return true;
    }

    @Override
    protected void initView() {
        binding = DataBindingUtil.setContentView(FeedbackActivity.this, R.layout.activity_feedback);
        binding.setViewModel(viewModel);
    }

    @Override
    protected void init() {
        super.init();
        binding.include.titleView.setText("意见反馈");
        binding.include.ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        binding.tvSubmit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (TextUtils.isEmpty(binding.etContent.getText())){
                    MToast.showToast(FeedbackActivity.this, "请输入反馈内容");
                    return;
                }

                MToast.showToast(FeedbackActivity.this, "提交成功,感谢反馈");
                finish();
            }
        });
    }
}